# coding=utf-8
from comment.ultils.Serializers import BsaeListSerializer,BaseSerializer

class InvitedListSerializer(BsaeListSerializer):
    """被邀请列表的序列化"""
    def to_dict(self):
        list = []
        for obj in self.data:
            list.append(
                {
                    'name': obj.username,
                    'registerTime': obj.registerTime.strftime("%Y-%m-%d"),
                    "award": '代金券50',
                }
            )
        return list

class UserInfoSerializer(BaseSerializer):
    """用户信息序列化"""

    def to_dict(self):
        obj = self.data
        return {
            'id': obj.username, #用户名
            "realNameAuth": obj.realNameStatus, #实名认证
            "phoneStatus": obj.phone, #手机的认证
            'loginPwdstatus': 1, #登录密码
            "payPwdStatus": obj.payPwdStatus, #支付密码
            'avatar': obj.avatar, #头像
            'invite_code': obj.inviteId, #邀请码
            'phone': obj.phone #手机号
        }










